﻿using SilverlightApplicationReservations.Web;
using System.Windows.Controls;
using System.Windows.Navigation;
using System.ServiceModel.DomainServices.Client;

namespace SilverlightApplicationReservations
{
    public partial class Home : Page
    {
        private DomainServiceGetUpcomingEvents upcomingEventsDS;

        public Home()
        {
            InitializeComponent();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            upcomingEventsDS = new DomainServiceGetUpcomingEvents();
            upcomingEventsDS.Load(upcomingEventsDS.GetUpcomingEventsQuery());
            this.dataGridEvents.ItemsSource = upcomingEventsDS.Events;
        }
    }
}